package com.triones.framework.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 客户端类型
 *
 * @author triones
 * 2023-09-19
 */
@Getter
@AllArgsConstructor
public enum ClientTypeEnum {
    /**
     * 未知
     */
    UNKNOWN("未知", "UNKNOWN"),
    /**
     * 未认证用户端
     */
    NORMAL("未认证用户端", "NORMAL"),
    /**
     * 司机端
     */
    SJ("司机端", "SJ"),
    /**
     * 供应商端
     */
    GYS("供应商端", "GYS"),
    ;
    private String info;
    private String code;

    public static ClientTypeEnum convert(String code) {
        return Stream.of(values()).filter(o -> o.getCode().equalsIgnoreCase(code)).findFirst().orElse(UNKNOWN);
    }
}
